import { Tag } from 'antd';
import { WeaLocaleProvider } from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
import GovernLight from '../governPoint/light';
export default class GovernTag extends React.Component {

    render() {
        const { record ,custyle} = this.props;
        let is_showlight = record.statusspan.split("_")[1];
        return (
            is_showlight == '0' ? (
                <div className="g-governTag" style={custyle}>
                    {this.getTag()}
                </div>
            ) : (
                    <GovernLight ecId={`${this && this.props && this.props.ecId || ''}_GovernLight@zbvhs1`} {...this.props}/>
                )

        )
    }
    getTag = () => {
        const { record } = this.props;
        let isFinishTask = this.props.isFinishTask; //任务完成标志 
        let isDiscard = this.props.isDiscard;//任务废弃标志

        let statusspan = record.statusspan.split("_")[0];
        if (statusspan === "0" || record.value === "0" && isFinishTask == false && isDiscard == false) {//未开始 0
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@o7k7ib`} color="#ff9000">{getLabel(383418, "未开始")}</Tag>;
        } else if (statusspan === "1" || record.value === "1" && isFinishTask == false && isDiscard == false) {//进行中 1
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@ufr7yq`} color="#2db7f5">{getLabel(501498, "进行中")}</Tag>;
        } else if (statusspan === "2" || record.value === "2" && isFinishTask == false && isDiscard == false) {//已超期 2
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@newllr`} color="#f50">{getLabel(21984, "已超期")}</Tag>;
        } else if (statusspan === "3" || record.value === "3" || isFinishTask == true && isDiscard == false) {//已完成 3
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@tizb7t`} color="#87d068">{getLabel(23774, "已完成")}</Tag>;
        } else if (statusspan === "4" || record.value === "4" && isFinishTask == false && isDiscard == false) {//已废弃 4
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@jhqo11`} color="#c7bfbc">{getLabel('126185,81999', "已废弃")}</Tag>;
        } else if (statusspan === "5" || record.value === "5" && isFinishTask == false && isDiscard == false) {//已删除 4
            return <Tag ecId={`${this && this.props && this.props.ecId || ''}_Tag@y0yo7h`} color="#c7bfbc">{getLabel(18967, "已删除")}</Tag>;
        }
    }
}